INFINITE LOOP: Click and use your mouse to avoid the asteroids. The game runs infinitely! Use when ready. while loops are controlled by a condition that is made of Booleans and expressions just like if statements.

  • The loop is infinite! Examine the condition in the while loop. It will only stop if it becomes False.
  • Correct the first half of the condition so that it compares lives to the correct data type. lives is an integer!
  • Correct the logical operator in the condition, so that the game ends when lives is 0 and time is less than 10.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)